package com.example.mcp.server.model;

import com.fasterxml.jackson.annotation.JsonProperty;

public class McpInitializeResponse extends McpMessage {

    @JsonProperty("protocolVersion")
    private String protocolVersion;

    @JsonProperty("capabilities")
    private ServerCapabilities capabilities;

    @JsonProperty("serverInfo")
    private ServerInfo serverInfo;

    public McpInitializeResponse() {
        this.setType("initialize");
        this.setProtocolVersion("2024-11-05");
        this.setCapabilities(new ServerCapabilities());
        this.setServerInfo(new ServerInfo());
    }

    public String getProtocolVersion() {
        return protocolVersion;
    }

    public void setProtocolVersion(String protocolVersion) {
        this.protocolVersion = protocolVersion;
    }

    public ServerCapabilities getCapabilities() {
        return capabilities;
    }

    public void setCapabilities(ServerCapabilities capabilities) {
        this.capabilities = capabilities;
    }

    public ServerInfo getServerInfo() {
        return serverInfo;
    }

    public void setServerInfo(ServerInfo serverInfo) {
        this.serverInfo = serverInfo;
    }

    public static class ServerCapabilities {

        @JsonProperty("experimental")
        private Object experimental;

        @JsonProperty("logging")
        private Object logging;

        @JsonProperty("prompts")
        private Object prompts;

        @JsonProperty("resources")
        private ResourcesCapabilities resources;

        @JsonProperty("tools")
        private ToolsCapabilities tools;

        public ServerCapabilities() {
            this.experimental = null;
            this.logging = null;
            this.prompts = null;
            this.resources = new ResourcesCapabilities();
            this.tools = new ToolsCapabilities();
        }

        public Object getExperimental() {
            return experimental;
        }

        public void setExperimental(Object experimental) {
            this.experimental = experimental;
        }

        public Object getLogging() {
            return logging;
        }

        public void setLogging(Object logging) {
            this.logging = logging;
        }

        public Object getPrompts() {
            return prompts;
        }

        public void setPrompts(Object prompts) {
            this.prompts = prompts;
        }

        public ResourcesCapabilities getResources() {
            return resources;
        }

        public void setResources(ResourcesCapabilities resources) {
            this.resources = resources;
        }

        public ToolsCapabilities getTools() {
            return tools;
        }

        public void setTools(ToolsCapabilities tools) {
            this.tools = tools;
        }
    }

    public static class ResourcesCapabilities {

        @JsonProperty("subscribe")
        private Boolean subscribe;

        @JsonProperty("listChanged")
        private Boolean listChanged;

        public ResourcesCapabilities() {
            this.subscribe = false;
            this.listChanged = false;
        }

        public Boolean getSubscribe() {
            return subscribe;
        }

        public void setSubscribe(Boolean subscribe) {
            this.subscribe = subscribe;
        }

        public Boolean getListChanged() {
            return listChanged;
        }

        public void setListChanged(Boolean listChanged) {
            this.listChanged = listChanged;
        }
    }

    public static class ToolsCapabilities {

        @JsonProperty("listChanged")
        private Boolean listChanged;

        public ToolsCapabilities() {
            this.listChanged = false;
        }

        public Boolean getListChanged() {
            return listChanged;
        }

        public void setListChanged(Boolean listChanged) {
            this.listChanged = listChanged;
        }
    }

    public static class ServerInfo {

        @JsonProperty("name")
        private String name;

        @JsonProperty("version")
        private String version;

        public ServerInfo() {
            this.name = "Spring AI MCP Server";
            this.version = "1.0.0";
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getVersion() {
            return version;
        }

        public void setVersion(String version) {
            this.version = version;
        }
    }
}